# 继承: 让类和类之间转变为父子关系
# 继承: 子类默认继承父类的所有属性和方法

class Animal:
    def __init__(self, name):
        self.name = name

    def eat(self):
        print(f"{self.name} is eating.")

    def sleep(self):
        print(f"{self.name} is sleeping.")

class Dog(Animal):
    def bark(self):
        print(f"{self.name} is barking.")

class Cat(Animal):
    pass

dog1 = Dog("Buddy")
print(dog1.name)  # Buddy
dog1.sleep()
dog1.eat()
dog1.bark()
cat = Cat("Whiskers")
cat.eat()
cat.sleep()
